UpdateInfo UpdateInfo::parseString(const QString &xml, bool *ok)
{
- QString errorMsg;
- int errorLine = 0, errorCol = 0;
QDomDocument doc;
- if (!doc.setContent(xml, false, &errorMsg, &errorLine, &errorCol)) {
- qCWarning(lcUpdater).noquote().nospace() << errorMsg << " at " << errorLine << "," << errorCol
- << "\n" << xml.split("\n").value(errorLine-1) << "\n"
- << QString(" ").repeated(errorCol - 1) << "^\n"
+ if (const auto result = doc.setContent(xml); !result) {
+ qCWarning(lcUpdater).noquote().nospace() << result.errorMessage << " at " << result.errorLine << "," << result.errorColumn
+ << "\n" << xml.split("\n").value(result.errorLine - 1) << "\n"
+ << QString(" ").repeated(result.errorColumn - 1) << "^\n"
<< "->" << xml << "<-";
if (ok)
*ok = false;
if (http_result_code == 207) {
// Parse DAV response
auto domDocument = QDomDocument();
- auto errorMsg = QString();
- auto errorLine = -1;
- auto errorColumn = -1;
- if (!domDocument.setContent(reply(), true, &errorMsg, &errorLine, &errorColumn)) {
- qCWarning(lcPropfindJob) << "XML parser error: " << errorMsg << errorLine << errorColumn;
+ if (const auto res = domDocument.setContent(reply(), QDomDocument::ParseOption::UseNamespaceProcessing); !res) {
+ qCWarning(lcPropfindJob) << "XML parser error: " << res.errorMessage << res.errorLine << res.errorColumn;
emit finishedWithError(reply());
} else {